// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Serverless.Fluent;
using Elastic.Clients.Elasticsearch.Serverless.Serialization;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Serverless.Aggregations;

public sealed partial class TermsPartition
{
	/// <summary>
	/// <para>The number of partitions.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("num_partitions")]
	public long NumPartitions { get; set; }

	/// <summary>
	/// <para>The partition number for this request.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("partition")]
	public long Partition { get; set; }
}

public sealed partial class TermsPartitionDescriptor : SerializableDescriptor<TermsPartitionDescriptor>
{
	internal TermsPartitionDescriptor(Action<TermsPartitionDescriptor> configure) => configure.Invoke(this);

	public TermsPartitionDescriptor() : base()
	{
	}

	private long NumPartitionsValue { get; set; }
	private long PartitionValue { get; set; }

	/// <summary>
	/// <para>The number of partitions.</para>
	/// </summary>
	public TermsPartitionDescriptor NumPartitions(long numPartitions)
	{
		NumPartitionsValue = numPartitions;
		return Self;
	}

	/// <summary>
	/// <para>The partition number for this request.</para>
	/// </summary>
	public TermsPartitionDescriptor Partition(long partition)
	{
		PartitionValue = partition;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		writer.WritePropertyName("num_partitions");
		writer.WriteNumberValue(NumPartitionsValue);
		writer.WritePropertyName("partition");
		writer.WriteNumberValue(PartitionValue);
		writer.WriteEndObject();
	}
}